FROM alpine:3.16

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories

RUN apk update && apk add --no-cache wget tzdata bash curl libevent nload

ARG TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apk add --no-cache \
    php8-cli \
    php8-redis \
    php8-pcntl \
    php8-posix \
    php8-iconv \
    php8-pdo \
    php8-gd \
    php8-pdo_mysql \
    php8-bcmath \
    php8-fileinfo \
    php8-simplexml \
    php8-tokenizer \
    php8-sodium \
    composer

RUN composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

WORKDIR /opt/www/

COPY composer.* /opt/www/

RUN composer install --no-dev -o

COPY . /opt/www

EXPOSE 8787

CMD ["php","/opt/www/start.php","start"]